{{ header }}
<div id="information-tracking" class="container">
  <ul class="breadcrumb">
    {% for breadcrumb in breadcrumbs %}
      <li class="breadcrumb-item"><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
    {% endfor %}
  </ul>
  <div class="row">{{ column_left }}
    <div id="content" class="col">{{ content_top }}
      <h1>{{ heading_title }}</h1>
      <p>Please enter your shipping tracking No. below:</p>
      <div class="form-group row required">
        <label class="col-sm-2 col-form-label" for="input-code">{{ entry_code }} </label>
        <div class="col-sm-10">
          <input type="text" name="code" value="{{ code }}" placeholder="{{ entry_code }}" id="input-code" class="form-control"/>
        </div>
      </div>
      {{ content_bottom }}</div>
    {{ column_right }}
  </div>
</div>
<script type="text/javascript"><!--
$('#button-tracking').on('click', function() {
	$.ajax({
		url: 'index.php?route=information/tracking/tracking&code=' + $('input[name=\'code\']').val(),
		dataType: 'json',
		beforeSend: function() {
			$('#button-login').button('loading');
		},
		complete: function() {
			$('#button-login').button('reset');
		},
		success: function(json) {
			$('.alert-dismissible, .text-danger').remove();
			$('.form-group').removeClass('has-error');

			if (json['redirect']) {
				location = json['redirect'];
			} else if (json['error']) {
				$('#collapse-checkout-option .panel-body').prepend('<div class="alert alert-danger alert-dismissible"><i class="fas fa-exclamation-circle"></i> ' + json['error']['warning'] + '<button type="button" class="close" data-dismiss="alert">&times;</button></div>');

				// Highlight any found errors
				$('input[name=\'email\']').parent().addClass('has-error');
				$('input[name=\'password\']').parent().addClass('has-error');
			}
		},
		error: function(xhr, ajaxOptions, thrownError) {
			alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
		}
	});
});
--></script>
{{ footer }}